package com.kxscs.bean;

import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by taoy2 on 15-12-4.
 */
public class OrderBean implements Serializable,Cloneable,Type{
    private int state;
    public String orderno;
    public String insert_time;
    public String start_name;
    public String start_id;
    public String des_name;
    public String des_id;
    public String sc_name;
    public String sc_id;
    public String cls;
    public String etd;
    public String bgt;
    //联系人
    public ContactsBean contacts = new ContactsBean();
    //箱型
    public List<BoxBean> connum = new ArrayList<>();
    //货物信息
    public Cargoinf cargoinf = new Cargoinf();
    public String remark;
    //报关
    public int declare;//0否，１是
    public int trail;
    public int release_type;//0船东正本
    //应收
    public CostBean receivable = new CostBean();
    //应付
    public CostBean payable = new CostBean();

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String tipConnum() {
        String box="";
        for (int i = 0; i < connum.size(); i++) {
            box+= connum.get(i).name+"："+ connum.get(i).number;
            if(i< connum.size()-1){
                box+="/";
            }
        }
        return box;
    }

    public OrderBean copy() {
        List<BoxBean> connums= new ArrayList<>();
        for (int i = 0; i < connum.size(); i++) {
            connums.add(connum.get(i).clone());
        }
        return  new OrderBean(start_name,start_id,des_name,des_id,sc_name, sc_id, cls, etd,bgt,
                contacts.copy(), connums, cargoinf.copy(), remark,declare,trail,release_type,
                receivable.copy(),payable.copy());
    }

    public OrderBean() {
    }

    public OrderBean(String start_name, String start_id, String des_name, String des_id,
                     String sc_name, String sc_id, String cls, String etd, String bgt,
                     ContactsBean contacts, List<BoxBean> connum, Cargoinf cargoinf, String remark,
                     int declare, int trail, int release_type, CostBean receivable, CostBean payable) {
        this.start_name = start_name;
        this.start_id = start_id;
        this.des_name = des_name;
        this.des_id = des_id;
        this.sc_name = sc_name;
        this.sc_id = sc_id;
        this.cls = cls;
        this.etd = etd;
        this.bgt = bgt;
        this.contacts = contacts;
        this.connum = connum;
        this.cargoinf = cargoinf;
        this.remark = remark;
        this.declare = declare;
        this.trail = trail;
        this.release_type = release_type;
        this.receivable = receivable;
        this.payable = payable;
    }

    @Override
    public String toString() {
        return "{" +
                "start_name='" + start_name + '\'' +
                ", start_id='" + start_id + '\'' +
                ", des_name='" + des_name + '\'' +
                ", des_id='" + des_id + '\'' +
                ", sc_name='" + sc_name + '\'' +
                ", sc_id='" + sc_id + '\'' +
                ", cls='" + cls + '\'' +
                ", etd='" + etd + '\'' +
                ", bgt='" + bgt + '\'' +
                ", contacts=" + contacts +
                ", connum=" + connum +
                ", cargoinf=" + cargoinf +
                ", remark='" + remark + '\'' +
                ", declare=" + declare +
                ", trail=" + trail +
                ", release_type=" + release_type +
                ", receivable=" + receivable +
                ", payable=" + payable +
                '}';
    }
}
